package com.traffic.api.dao;

import com.traffic.api.entity.VirtualTransitCard;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface VirtualTransitCardMapper extends BaseMapper<VirtualTransitCard> {

    List<VirtualTransitCard> findByConditions(Map<String, Object> conditions);

    @Select("SELECT id,user_id AS userId FROM virtual_transit_card WHERE user_id=#{userId}" +
            " AND result= #{result} AND deleted = #{deleted}  LIMIT 1")
    Map<String, Object> checkCard(@Param("userId") String userId, @Param("deleted") String deleted, @Param("result") String result);

    VirtualTransitCard getByUserId(String userId);
}